﻿<Window x:Class="Coding4Fun.BoxingBots.Boxer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Coding4Fun.BoxingBots.Boxer"
        xmlns:Controls="clr-namespace:Coding4Fun.BoxingBots.Boxer.Controls" Title="Coding4Fun Boxing Bot"
        SizeToContent="WidthAndHeight" 
        SnapsToDevicePixels="True" 
        WindowStartupLocation="CenterScreen"
        ResizeMode="NoResize" 
		Icon="/media/favicon.ico" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" Loaded="Window_Loaded">
	<Grid Margin="12, 12, 0, 0">
		<StackPanel>
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition />
					<ColumnDefinition />
					<ColumnDefinition />
					<ColumnDefinition />
					<ColumnDefinition />
					<ColumnDefinition />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition />
					<RowDefinition />
				</Grid.RowDefinitions>
				<StackPanel Grid.Column="4">
					<Controls:SensorData 
						Title="Wheel:"
						FrontLeftSensor="{Binding LeftMotorFront, RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}}"
						FrontRightSensor="{Binding RightMotorFront, RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}}"
						RearLeftSensor="{Binding LeftMotorBack, RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}}"
						RearRightSensor="{Binding RightMotorBack, RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}}"
						/>
					
					<Controls:SensorData 
						x:Name="SensorDataDisplay"
						Title="Chest:"
						/>
					
					<Button
						PreviewMouseLeftButtonDown="Button_PreviewMouseLeftButtonDown" 
						PreviewMouseLeftButtonUp="Button_PreviewMouseLeftButtonUp">
						Fake Hit
					</Button>
				</StackPanel>
				<StackPanel Grid.Column="5" Orientation="Horizontal">
					<Grid>
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto" />
							<RowDefinition />
							<RowDefinition Height="Auto" />
						</Grid.RowDefinitions>
						<TextBlock FontWeight="Bold" FontSize="16" >Health:</TextBlock>
						<Slider
							Name="BoxerHealth"
							Grid.Row="1"
							Orientation="Vertical" 
							HorizontalAlignment="Center" 
							Minimum="0" 
							Maximum="8" 
							Value="8"
							IsSnapToTickEnabled="True" ValueChanged="BoxerHealth_ValueChanged" />
						<TextBlock 
							Grid.Row="2"
							Text="{Binding ElementName=BoxerHealth, Path=Value}" />
					</Grid>

					<Controls:VisualButton
						x:Name="ExtendHeadButton" 
						Grid.Column="3"
						Grid.RowSpan="2"
						Title="extend head"
						Button="A"
						/>
				</StackPanel>
				<Controls:VisualButton
					x:Name="LeftPunchButton" 
					Grid.Column="0"
					Grid.RowSpan="2"
					Title="left punch"
					Button="Left"
					/>
				<Controls:BoxerThumbStick
					Title="Vector:"
					x:Name="MovementVector"
					Grid.Column="1" 
					DeadzoneChanged="MovementVectorDeadzoneChanged"
					/>
				<Controls:BoxerThumbStick
					Title="Rotation:"
					x:Name="RotationVector"
					Grid.Column="2" 
					DeadzoneChanged="RotationVectorDeadzoneChanged"
					/>
				<Controls:VisualButton
					x:Name="RightPunchButton" 
					Grid.Column="3"
					Grid.RowSpan="2"
					Title="right punch"
					Button="Right"
					/>
			</Grid>
			
			<Grid Margin="0, 12, 0, 0">
				<Grid.ColumnDefinitions>
					<ColumnDefinition />
					<ColumnDefinition />
					<ColumnDefinition Width="150" />
				</Grid.ColumnDefinitions>
				<StackPanel Grid.Column="0" Margin="0, 0, 12, 12">
					<TextBlock FontWeight="Bold" FontSize="16" >
						Robot:
						<Run Name="ServerIP" FontWeight="Normal">unknown</Run>
					</TextBlock>
				</StackPanel>
				<StackPanel Grid.Column="1">
					<TextBlock FontWeight="Bold" FontSize="16" >
						Robot:
						<Run Name="RobotStatus" FontWeight="Normal">unknown</Run>
					</TextBlock>
					<TextBlock FontWeight="Bold" FontSize="16" >
						Socket:
						<Run Name="SocketStatus" FontWeight="Normal">unknown</Run>
					</TextBlock>
					<TextBlock FontWeight="Bold" FontSize="16" >
						Controller:
						<Run Name="ControllerStatus" FontWeight="Normal">unknown</Run>
					</TextBlock>
                    <TextBlock FontWeight="Bold" FontSize="16" >
						Input:
						<Run Name="InputState" FontWeight="Normal">Network</Run>
                    </TextBlock>
                </StackPanel>
				<Image 
                    Grid.ColumnSpan="3"
                    Source="/media/Coding4FunTextOnly.png" 
                    Stretch="None"
					SnapsToDevicePixels="True"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Bottom"
                    Margin="5, -19"/>
			</Grid>
		</StackPanel>

	</Grid>
</Window>
